/**
*@Author: QWP
*@Description: 用户相关接口
*@Date 2024-08-06 19:04
*/
import request from '@/http'

// 分页列表查询
export const page = async (data: object) => {
  return await request.post({
    url: '/authority/sysTUser/page',
    data: data
  })
}

// 分页列表查询
export const userPage = async (data: object) => {
  return await request.post({
    url: '/authority/sysTUser/userPage',
    data: data
  })
}

// 新增
export const add = async (data: object) => {
  return await request.post({
    url: '/authority/sysTUser',
    data: data
  })
}

// 修改
export const update = async (data: object) => {
  return await request.post({
    url: '/authority/sysTUser/update',
    data: data
  })
}

// 删除
export const del = async (data: Array<any>) => {
  return await request.post({
    url: '/authority/sysTUser/delete',
    data,
    headersType: 'application/x-www-form-urlencoded'
  })
}

// 角色人员下拉框
export const roleuserselectdata = async (data: Array<any>) => {
  return await request.post({
    url: '/api/authority/sysTUser/roleuserselectdata',
    data,
    headersType: 'application/x-www-form-urlencoded'
  })
}

// 修改密码
export const password = async (data: object) => {
  return await request.post({
    url: '/authority/sysTUser/password',
    data: data
  })
}

// 解锁
export const unlock = async (data: object) => {
  return await request.post({
    url: '/authority/sysTUser/unlock',
    data: data
  })
}

// 重置为初始密码
export const resetInitPW = async (data: object) => {
  return await request.post({
    url: '/authority/sysTUser/resetInitPW',
    data: data
  })
}

// 启用停用
export const isenable = async (data: object) => {
  const tData = data['userids'] || []
  return await request.post({
    url: '/authority/sysTUser/isenable/'+ data['isenable'],
    data: tData
  })
}

// 检测名称是否可用
export const check = async (params: any) => {
  return await request.get({
    url: '/authority/sysTUser/check',
    params
  })
}

// 单体查询
export const query = async (data: any) => {
  return await request.get({
    url: '/authority/sysTUser/' + data,
  })
}

// 导出
export const download = async (data: any) => {
  return await request.download1({
    url: '/authority/sysTUser/export',
    data
  })
}


// 根据单位id部门和人员组合树
export const tree = async (data: any) => {
  return await request.get({
    url: '/authority/sysTUser/tree/' + data,
  })
}


// tree: (data) => getService(api + '/authority/sysTUser/tree/'+ data),